package com.he.strategymodel.aop;

import com.he.strategymodel.context.StategyContext;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class JdkInvocationHandler implements InvocationHandler {

    private StategyContext stategyContext;

    public JdkInvocationHandler(StategyContext stategyContext) {
        this.stategyContext = stategyContext;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("欢迎光临");
        Object invoke = method.invoke(stategyContext, args);
        System.out.println("谢谢惠顾");
        return invoke;
    }
}
